{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from bokeh.plotting import figure, show, output_notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## player: AI"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "class Player:\n",
    "\n",
    "    def __init__(self, heap):\n",
    "        self.history = {}\n",
    "        self.distribution = np.ones((heap + 1, 3), dtype=int)\n",
    "        self.cutoff = 1000\n",
    "\n",
    "    def __call__(self, heap):\n",
    "        # randomize move based on previous games\n",
    "        dist = self.distribution[heap].cumsum()\n",
    "        rnd = np.random.randint(dist[2])\n",
    "        move = 1 if rnd < dist[0] else 2 if rnd < dist[1] else 3\n",
    "        \n",
    "        # store move in history\n",
    "        self.history[heap] = min(heap, move)\n",
    "        \n",
    "        return self.history[heap]\n",
    "\n",
    "    def learn(self, winner):\n",
    "        # update move distribution\n",
    "        for heap, move in self.history.items():\n",
    "            if winner is self:\n",
    "                self.distribution[heap][move - 1] += 1\n",
    "            else:\n",
    "                self.distribution[heap][move - 1] -= 1\n",
    "                self.distribution[heap] += 1\n",
    "\n",
    "        # normalize distribution to speed learning up\n",
    "        normalize = np.argwhere(self.distribution.sum(axis=1) > self.cutoff)\n",
    "        for heap in normalize:\n",
    "            self.distribution[heap] -= self.distribution[heap].min() - 1\n",
    "\n",
    "        # reset game history\n",
    "        self.history = {}\n",
    "    \n",
    "    def strategy(self):\n",
    "        distribution = self.distribution[1:]\n",
    "        return distribution.T / distribution.sum(axis=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## opponents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def expert_opponent(heap):\n",
    "    return heap % 4 or min(heap, np.random.randint(1, 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def random_opponent(heap):\n",
    "    return min(heap, np.random.randint(1, 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def take_n_opponent(take):\n",
    "    return lambda heap: min(heap, take)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## training"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def play(heap, player, opponent):\n",
    "    players = player, opponent\n",
    "    wins = 0\n",
    "\n",
    "    for game in range(100001):\n",
    "        # update plot periodically\n",
    "        if game % 10000 == 0:\n",
    "            print(game, 'games, W/L ratio', wins / 10000)\n",
    "            wins = 0\n",
    "\n",
    "        # a single game\n",
    "        h = heap\n",
    "        while h:\n",
    "            h -= players[0](h)\n",
    "            players = players[1], players[0]\n",
    "\n",
    "        winner = players[1]\n",
    "        wins += winner is player\n",
    "            \n",
    "        # let player learn\n",
    "        player.learn(winner)\n",
    "        \n",
    "    # plot distribution\n",
    "    plot_strategy(heap, player)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def plot_strategy(heap, player):\n",
    "    output_notebook()\n",
    "\n",
    "    # data\n",
    "    take_1, take_2, take_3 = player.strategy()\n",
    "    take_2 += take_1\n",
    "    take_3 += take_2\n",
    "    kwargs = {'x': range(1, heap + 1), 'width': .8}\n",
    "\n",
    "    # plot\n",
    "    plot = figure(plot_width=600, plot_height=400)\n",
    "    plot.vbar(**kwargs, bottom=0, top=take_1, legend='take 1', color='#a44444')\n",
    "    plot.vbar(**kwargs, bottom=take_1, top=take_2, legend='take 2', color='#88a888')\n",
    "    plot.vbar(**kwargs, bottom=take_2, top=take_3, legend='take 3', color='#ccccac')\n",
    "    show(plot)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## learning"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "HEAP = 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 games, W/L ratio 0.0\n",
      "10000 games, W/L ratio 0.0082\n",
      "20000 games, W/L ratio 0.0129\n",
      "30000 games, W/L ratio 0.0146\n",
      "40000 games, W/L ratio 0.0321\n",
      "50000 games, W/L ratio 0.0325\n",
      "60000 games, W/L ratio 0.1141\n",
      "70000 games, W/L ratio 0.4532\n",
      "80000 games, W/L ratio 0.4985\n",
      "90000 games, W/L ratio 0.4992\n",
      "100000 games, W/L ratio 0.4994\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"bbada34c-95a7-465e-b99f-62634cc35fd5\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    window._bokeh_timeout = Date.now() + 5000;\n",
       "    window._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (window.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"bbada34c-95a7-465e-b99f-62634cc35fd5\");\n",
       "      el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "    } else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"bbada34c-95a7-465e-b99f-62634cc35fd5\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'bbada34c-95a7-465e-b99f-62634cc35fd5' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"bbada34c-95a7-465e-b99f-62634cc35fd5\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!window._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      window._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"bbada34c-95a7-465e-b99f-62634cc35fd5\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"d461e007-8052-4489-87d5-a82d28096cca\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      window._bokeh_timeout = Date.now() + 0;\n",
       "      window._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (window.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"d461e007-8052-4489-87d5-a82d28096cca\");\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      } else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"d461e007-8052-4489-87d5-a82d28096cca\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'd461e007-8052-4489-87d5-a82d28096cca' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"bcc21079-b6d6-4f87-9cb5-9901c088cac9\":{\"roots\":{\"references\":[{\"attributes\":{\"data_source\":{\"id\":\"20467719-4f21-4159-99ce-9e7221f10198\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"9c61354c-742f-460d-b4d0-e61b6199a038\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"d4daafa0-56b7-4c3a-9e41-96543f28a83a\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"daf4ec0a-7bd3-4e89-84da-18b7f2a7a642\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"#a44444\"},\"line_color\":{\"value\":\"#a44444\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"9c61354c-742f-460d-b4d0-e61b6199a038\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"e26b40ce-65cf-455e-ae94-f5f9ad2ca500\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"feeefc94-5e75-411c-a6e2-777ae365b930\",\"type\":\"ToolEvents\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d77e49a8-4707-4295-b815-cee0a6cdb369\",\"type\":\"BasicTicker\"}},\"id\":\"92ea51f1-c365-4623-ad35-5156e755fcb3\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"9t8JBrr97z8w9PlQz+QhP13c6ULtIjI/YbE1WGwN1j9aQkuqSvnvPx4wrzWIRiI/Ifg7wTWtIT91UAd1UAfVP7BV+q9V+u8/zYrwOi9HIj9V2E0pCzMyP1ZX4FHCLNY/RlVYKev47z+az+loF2IiP5/hWbRY1CI/Bo/lvdoi1z9ost0YAvrvP+TY4Q1RGyM/qJu2j9FoIz8otbfI5J/UP6PTn4O7/u8/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"++8EA93+7z8Gg1eYDffvP4zKXuRjNDs/X/e6173u5T9Ltz7jaPrvP0E5b/VJ+u8/MvTZodCDOj8i5z67gNjkP/Dd/u/d/u8/76EYGrf97z+AxPS9kEw7Pzo+VtqwzOU/jGM53NH+7z9jcYne2f7vP5/hWbRY1DI/zgQMHst75T/iViw4zf7vP+Mh70rO/u8/qJu2j9FoMz82ZU1ZU9bkP+GbitaT/+8/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"a7e276b0-ef39-4cde-8da0-c2298cfca529\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"05b72eb1-a90b-4bce-9c4f-9fb4ae5c6ea4\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"711e56f4-1d6e-4ca1-b1b5-1b2e67317521\",\"type\":\"Title\"},{\"attributes\":{\"label\":{\"value\":\"take 3\"},\"renderers\":[{\"id\":\"abd1f2fe-5458-48ca-a6ea-fe3889c3fc65\",\"type\":\"GlyphRenderer\"}]},\"id\":\"ae763da4-375d-4e56-9d64-683cfb261efb\",\"type\":\"LegendItem\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"80689dea-49b5-4d12-8730-8440a25cfc20\",\"type\":\"PanTool\"},{\"id\":\"e752de37-ef9d-4620-b3d1-4832d3f60092\",\"type\":\"WheelZoomTool\"},{\"id\":\"6a8245af-1ca9-4b02-877a-8e431055e852\",\"type\":\"BoxZoomTool\"},{\"id\":\"3ba3d61c-c447-4316-b754-213357d59b0d\",\"type\":\"SaveTool\"},{\"id\":\"a322e41f-b23b-4a3c-8c77-0ab4f4f0b086\",\"type\":\"ResetTool\"},{\"id\":\"12caf3f1-0ac5-4698-90f6-26195a3a8175\",\"type\":\"HelpTool\"}]},\"id\":\"529feeef-5e04-4c0c-b544-5fdff960fe7c\",\"type\":\"Toolbar\"},{\"attributes\":{\"below\":[{\"id\":\"48bcb76b-377f-48d3-a334-374e6deced56\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"96e7f33d-34a2-46f8-a795-e705b1832ad5\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"renderers\":[{\"id\":\"48bcb76b-377f-48d3-a334-374e6deced56\",\"type\":\"LinearAxis\"},{\"id\":\"1cd5cc90-6eeb-4485-b6a1-d698bbd747a0\",\"type\":\"Grid\"},{\"id\":\"96e7f33d-34a2-46f8-a795-e705b1832ad5\",\"type\":\"LinearAxis\"},{\"id\":\"92ea51f1-c365-4623-ad35-5156e755fcb3\",\"type\":\"Grid\"},{\"id\":\"8e5d05f5-95bb-4679-a19a-e92ac3b8cdde\",\"type\":\"BoxAnnotation\"},{\"id\":\"6a871dae-c770-482b-a4a0-c09b729a1e11\",\"type\":\"Legend\"},{\"id\":\"daf4ec0a-7bd3-4e89-84da-18b7f2a7a642\",\"type\":\"GlyphRenderer\"},{\"id\":\"4b9d85ca-1b10-455b-a3fe-c17abc0986ab\",\"type\":\"GlyphRenderer\"},{\"id\":\"abd1f2fe-5458-48ca-a6ea-fe3889c3fc65\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"711e56f4-1d6e-4ca1-b1b5-1b2e67317521\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"feeefc94-5e75-411c-a6e2-777ae365b930\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"529feeef-5e04-4c0c-b544-5fdff960fe7c\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"e143cb84-070c-4f98-9bc6-e80f9ccdf268\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"e9cc9956-535b-4844-995e-7740c0bd899e\",\"type\":\"DataRange1d\"}},\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"a94a7ce2-0490-451f-8ac3-38769545b85d\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"callback\":null},\"id\":\"e143cb84-070c-4f98-9bc6-e80f9ccdf268\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"a94a7ce2-0490-451f-8ac3-38769545b85d\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"05b72eb1-a90b-4bce-9c4f-9fb4ae5c6ea4\",\"type\":\"BasicTicker\"}},\"id\":\"48bcb76b-377f-48d3-a334-374e6deced56\",\"type\":\"LinearAxis\"},{\"attributes\":{\"formatter\":{\"id\":\"e26b40ce-65cf-455e-ae94-f5f9ad2ca500\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"d77e49a8-4707-4295-b815-cee0a6cdb369\",\"type\":\"BasicTicker\"}},\"id\":\"96e7f33d-34a2-46f8-a795-e705b1832ad5\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"d77e49a8-4707-4295-b815-cee0a6cdb369\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"8e5d05f5-95bb-4679-a19a-e92ac3b8cdde\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"callback\":null},\"id\":\"e9cc9956-535b-4844-995e-7740c0bd899e\",\"type\":\"DataRange1d\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"++8EA93+7z8Gg1eYDffvP4zKXuRjNDs/X/e6173u5T9Ltz7jaPrvP0E5b/VJ+u8/MvTZodCDOj8i5z67gNjkP/Dd/u/d/u8/76EYGrf97z+AxPS9kEw7Pzo+VtqwzOU/jGM53NH+7z9jcYne2f7vP5/hWbRY1DI/zgQMHst75T/iViw4zf7vP+Mh70rO/u8/qJu2j9FoMz82ZU1ZU9bkP+GbitaT/+8/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"c207a7cc-5951-4fd7-b70e-83036b38fc69\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"05b72eb1-a90b-4bce-9c4f-9fb4ae5c6ea4\",\"type\":\"BasicTicker\"}},\"id\":\"1cd5cc90-6eeb-4485-b6a1-d698bbd747a0\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\"],\"data\":{\"top\":{\"__ndarray__\":\"9t8JBrr97z8w9PlQz+QhP13c6ULtIjI/YbE1WGwN1j9aQkuqSvnvPx4wrzWIRiI/Ifg7wTWtIT91UAd1UAfVP7BV+q9V+u8/zYrwOi9HIj9V2E0pCzMyP1ZX4FHCLNY/RlVYKev47z+az+loF2IiP5/hWbRY1CI/Bo/lvdoi1z9ost0YAvrvP+TY4Q1RGyM/qJu2j9FoIz8otbfI5J/UP6PTn4O7/u8/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"20467719-4f21-4159-99ce-9e7221f10198\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"16fd4413-6760-45ee-9da4-5c2e341b3e99\",\"type\":\"VBar\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"80689dea-49b5-4d12-8730-8440a25cfc20\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"e752de37-ef9d-4620-b3d1-4832d3f60092\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"overlay\":{\"id\":\"8e5d05f5-95bb-4679-a19a-e92ac3b8cdde\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"6a8245af-1ca9-4b02-877a-8e431055e852\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"data_source\":{\"id\":\"a7e276b0-ef39-4cde-8da0-c2298cfca529\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"28be253e-5bdc-40da-a888-d4b4b54f0ec8\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"8a8941af-4f0f-4720-89fe-e6df3fd9c5c4\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"4b9d85ca-1b10-455b-a3fe-c17abc0986ab\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"3ba3d61c-c447-4316-b754-213357d59b0d\",\"type\":\"SaveTool\"},{\"attributes\":{\"items\":[{\"id\":\"56a1ace1-2c53-436d-a997-97a99b3a4f8c\",\"type\":\"LegendItem\"},{\"id\":\"accf687b-e911-4e3b-ac71-729e872011fe\",\"type\":\"LegendItem\"},{\"id\":\"ae763da4-375d-4e56-9d64-683cfb261efb\",\"type\":\"LegendItem\"}],\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"6a871dae-c770-482b-a4a0-c09b729a1e11\",\"type\":\"Legend\"},{\"attributes\":{\"label\":{\"value\":\"take 1\"},\"renderers\":[{\"id\":\"daf4ec0a-7bd3-4e89-84da-18b7f2a7a642\",\"type\":\"GlyphRenderer\"}]},\"id\":\"56a1ace1-2c53-436d-a997-97a99b3a4f8c\",\"type\":\"LegendItem\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"a322e41f-b23b-4a3c-8c77-0ab4f4f0b086\",\"type\":\"ResetTool\"},{\"attributes\":{\"label\":{\"value\":\"take 2\"},\"renderers\":[{\"id\":\"4b9d85ca-1b10-455b-a3fe-c17abc0986ab\",\"type\":\"GlyphRenderer\"}]},\"id\":\"accf687b-e911-4e3b-ac71-729e872011fe\",\"type\":\"LegendItem\"},{\"attributes\":{\"plot\":{\"id\":\"681936e1-be7f-4299-980b-d83b0a358acd\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"12caf3f1-0ac5-4698-90f6-26195a3a8175\",\"type\":\"HelpTool\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#88a888\"},\"line_color\":{\"value\":\"#88a888\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"28be253e-5bdc-40da-a888-d4b4b54f0ec8\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"8a8941af-4f0f-4720-89fe-e6df3fd9c5c4\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#ccccac\"},\"line_color\":{\"value\":\"#ccccac\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"680d16f4-428a-4445-8d1e-357573d582e4\",\"type\":\"VBar\"},{\"attributes\":{\"data_source\":{\"id\":\"c207a7cc-5951-4fd7-b70e-83036b38fc69\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"680d16f4-428a-4445-8d1e-357573d582e4\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"16fd4413-6760-45ee-9da4-5c2e341b3e99\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"abd1f2fe-5458-48ca-a6ea-fe3889c3fc65\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"d4daafa0-56b7-4c3a-9e41-96543f28a83a\",\"type\":\"VBar\"}],\"root_ids\":[\"681936e1-be7f-4299-980b-d83b0a358acd\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.5\"}};\n",
       "            var render_items = [{\"docid\":\"bcc21079-b6d6-4f87-9cb5-9901c088cac9\",\"elementid\":\"d461e007-8052-4489-87d5-a82d28096cca\",\"modelid\":\"681936e1-be7f-4299-980b-d83b0a358acd\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i](window.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!window._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        window._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"d461e007-8052-4489-87d5-a82d28096cca\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "play(HEAP, Player(HEAP), expert_opponent)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 games, W/L ratio 0.0\n",
      "10000 games, W/L ratio 0.8589\n",
      "20000 games, W/L ratio 0.949\n",
      "30000 games, W/L ratio 0.9633\n",
      "40000 games, W/L ratio 0.9634\n",
      "50000 games, W/L ratio 0.9642\n",
      "60000 games, W/L ratio 0.9674\n",
      "70000 games, W/L ratio 0.9684\n",
      "80000 games, W/L ratio 0.9675\n",
      "90000 games, W/L ratio 0.9691\n",
      "100000 games, W/L ratio 0.9716\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"6c94c40c-3b4b-48f1-afe4-63cc61dd795c\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    window._bokeh_timeout = Date.now() + 5000;\n",
       "    window._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (window.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"6c94c40c-3b4b-48f1-afe4-63cc61dd795c\");\n",
       "      el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "    } else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"6c94c40c-3b4b-48f1-afe4-63cc61dd795c\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid '6c94c40c-3b4b-48f1-afe4-63cc61dd795c' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"6c94c40c-3b4b-48f1-afe4-63cc61dd795c\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!window._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      window._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"6c94c40c-3b4b-48f1-afe4-63cc61dd795c\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"d15ea997-9b6b-46ef-b33b-54fe24978d4b\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      window._bokeh_timeout = Date.now() + 0;\n",
       "      window._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (window.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"d15ea997-9b6b-46ef-b33b-54fe24978d4b\");\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      } else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"d15ea997-9b6b-46ef-b33b-54fe24978d4b\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'd15ea997-9b6b-46ef-b33b-54fe24978d4b' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"b8d953a1-f2f3-49ca-ba0e-f86f93f9730e\":{\"roots\":{\"references\":[{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#88a888\"},\"line_color\":{\"value\":\"#88a888\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"68fa1ef3-8b5c-45be-af9e-aec5d713c2be\",\"type\":\"VBar\"},{\"attributes\":{\"data_source\":{\"id\":\"beff35aa-4724-403d-a023-97d25f84d680\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"68fa1ef3-8b5c-45be-af9e-aec5d713c2be\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"7e042576-69cd-4236-91bb-fa9788948cc5\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"59fb4fa2-ee90-48b2-9710-89d853e6b0a6\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"Ri3aOrX/7z9HJu9GS/zvP9LQcES5WkM/TCu+uWz97z+AA+Hte//vPyT2Cjys/+8//FBrtsjIrj9Upu6C8+LLPwxaYiJ7/+8/bCsjL0T/7z9+syub6wzSP3fPFE+CReE/n1CeAdfF1D/Maq0cmP/tPzD/nYyj/+8/tBE7v2u46D9W1hvaOLvZPwg+RBNZutk/olLGErf/7z8X1cqo/f/uP8iNRndN/e8/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwP////////+8/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/////////7z8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"68083728-ddef-423e-881c-13c63d66f344\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"take 2\"},\"renderers\":[{\"id\":\"59fb4fa2-ee90-48b2-9710-89d853e6b0a6\",\"type\":\"GlyphRenderer\"}]},\"id\":\"98118d0a-dfa7-481a-b20e-ff1b7800cb2b\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"7e042576-69cd-4236-91bb-fa9788948cc5\",\"type\":\"VBar\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"497e826d-6b55-46da-ad7d-4406b2b0ea5b\",\"type\":\"VBar\"},{\"attributes\":{\"data_source\":{\"id\":\"68083728-ddef-423e-881c-13c63d66f344\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"763b2519-eed2-4899-9c4e-a731cd806119\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"497e826d-6b55-46da-ad7d-4406b2b0ea5b\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"222e8ed5-ca0b-4a7c-a151-21a29d19cb26\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"items\":[{\"id\":\"ef1e2ef1-44bb-48f8-ad69-52836f4886f6\",\"type\":\"LegendItem\"},{\"id\":\"98118d0a-dfa7-481a-b20e-ff1b7800cb2b\",\"type\":\"LegendItem\"},{\"id\":\"5194cef8-54cf-498f-bf3b-148f88b6e470\",\"type\":\"LegendItem\"}],\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"bcfe37d4-7370-4657-bc99-bf77b1005bb8\",\"type\":\"Legend\"},{\"attributes\":{\"label\":{\"value\":\"take 3\"},\"renderers\":[{\"id\":\"222e8ed5-ca0b-4a7c-a151-21a29d19cb26\",\"type\":\"GlyphRenderer\"}]},\"id\":\"5194cef8-54cf-498f-bf3b-148f88b6e470\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#ccccac\"},\"line_color\":{\"value\":\"#ccccac\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"763b2519-eed2-4899-9c4e-a731cd806119\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"324784de-cc89-42b0-93fb-f061935e4fcc\",\"type\":\"ToolEvents\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\"],\"data\":{\"top\":{\"__ndarray__\":\"i1q0dWr/7z/Fy82GyKX9Pk7TheLyVUI/dYkk4l7Z7z/mV6xSSDbvPyUepRn/Eag/Nj+S7vZE/T4r2tSrAeHLP2L5Rokm2+8/TdT2t2yz2T+7mf+IlPQDP4LxXNBcrQE/F+DWuz3F1D+GTj+YDf/tP96j3uR+8+o/UVH88rXTCT8AEZPntuoOP3V69H1v0gE/lgf8xaCk5z9djUVXqbkCP0EAoRL/BrE/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"7e13bd40-c133-42a7-8b12-65994f0e5db2\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e6131989-87eb-496d-a198-e7974a4c218f\",\"type\":\"BasicTicker\"}},\"id\":\"e4520dc9-3bb9-4fb9-813f-9cc08fd97e6a\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"i1q0dWr/7z/Fy82GyKX9Pk7TheLyVUI/dYkk4l7Z7z/mV6xSSDbvPyUepRn/Eag/Nj+S7vZE/T4r2tSrAeHLP2L5Rokm2+8/TdT2t2yz2T+7mf+IlPQDP4LxXNBcrQE/F+DWuz3F1D+GTj+YDf/tP96j3uR+8+o/UVH88rXTCT8AEZPntuoOP3V69H1v0gE/lgf8xaCk5z9djUVXqbkCP0EAoRL/BrE/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"Ri3aOrX/7z9HJu9GS/zvP9LQcES5WkM/TCu+uWz97z+AA+Hte//vPyT2Cjys/+8//FBrtsjIrj9Upu6C8+LLPwxaYiJ7/+8/bCsjL0T/7z9+syub6wzSP3fPFE+CReE/n1CeAdfF1D/Maq0cmP/tPzD/nYyj/+8/tBE7v2u46D9W1hvaOLvZPwg+RBNZutk/olLGErf/7z8X1cqo/f/uP8iNRndN/e8/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"beff35aa-4724-403d-a023-97d25f84d680\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"below\":[{\"id\":\"eb37af85-e5fd-4910-9e06-2a9edd20376b\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"fab4706a-32ad-4a4a-afe4-10a339a8f93f\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"renderers\":[{\"id\":\"eb37af85-e5fd-4910-9e06-2a9edd20376b\",\"type\":\"LinearAxis\"},{\"id\":\"b6c8c541-3c74-4507-bbb0-58d7bb89a81d\",\"type\":\"Grid\"},{\"id\":\"fab4706a-32ad-4a4a-afe4-10a339a8f93f\",\"type\":\"LinearAxis\"},{\"id\":\"e4520dc9-3bb9-4fb9-813f-9cc08fd97e6a\",\"type\":\"Grid\"},{\"id\":\"f9259bf8-f11d-4105-b80b-e25d59365246\",\"type\":\"BoxAnnotation\"},{\"id\":\"bcfe37d4-7370-4657-bc99-bf77b1005bb8\",\"type\":\"Legend\"},{\"id\":\"4c657569-cd5f-4ab3-9a57-ce57eb58f610\",\"type\":\"GlyphRenderer\"},{\"id\":\"59fb4fa2-ee90-48b2-9710-89d853e6b0a6\",\"type\":\"GlyphRenderer\"},{\"id\":\"222e8ed5-ca0b-4a7c-a151-21a29d19cb26\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"fc7a2cea-3538-48fc-8885-7a6fafa5a42d\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"324784de-cc89-42b0-93fb-f061935e4fcc\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"f9ceda94-2e19-4b42-843a-bbda53228935\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"df21cd99-6a79-4183-96b9-29c43b66c0b5\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"b8a6ad0b-8417-4db3-81be-7eab4d2d9fd9\",\"type\":\"DataRange1d\"}},\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"callback\":null},\"id\":\"b8a6ad0b-8417-4db3-81be-7eab4d2d9fd9\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"aed226aa-078d-4731-86db-f94a4465b4ef\",\"type\":\"BasicTicker\"}},\"id\":\"b6c8c541-3c74-4507-bbb0-58d7bb89a81d\",\"type\":\"Grid\"},{\"attributes\":{\"formatter\":{\"id\":\"21c54ded-cf0b-4055-9cdc-bc43232b7e8a\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"e6131989-87eb-496d-a198-e7974a4c218f\",\"type\":\"BasicTicker\"}},\"id\":\"fab4706a-32ad-4a4a-afe4-10a339a8f93f\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"fc7a2cea-3538-48fc-8885-7a6fafa5a42d\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"e6131989-87eb-496d-a198-e7974a4c218f\",\"type\":\"BasicTicker\"},{\"attributes\":{\"data_source\":{\"id\":\"7e13bd40-c133-42a7-8b12-65994f0e5db2\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"e6541246-cc2e-412c-a575-70842dce5b85\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"71346dbf-a1d1-4ab1-884a-1b726067d837\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"4c657569-cd5f-4ab3-9a57-ce57eb58f610\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"aed226aa-078d-4731-86db-f94a4465b4ef\",\"type\":\"BasicTicker\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"71346dbf-a1d1-4ab1-884a-1b726067d837\",\"type\":\"VBar\"},{\"attributes\":{\"formatter\":{\"id\":\"d63e7304-9274-4ce6-b2c3-1ba96062b9c7\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"aed226aa-078d-4731-86db-f94a4465b4ef\",\"type\":\"BasicTicker\"}},\"id\":\"eb37af85-e5fd-4910-9e06-2a9edd20376b\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"21c54ded-cf0b-4055-9cdc-bc43232b7e8a\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{},\"id\":\"d63e7304-9274-4ce6-b2c3-1ba96062b9c7\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"19f1022f-41ea-497f-a0d8-fccbe2ddce8d\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"37b52290-609e-46c0-a15c-d3418095a941\",\"type\":\"ResetTool\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"19f1022f-41ea-497f-a0d8-fccbe2ddce8d\",\"type\":\"PanTool\"},{\"id\":\"be2215fa-5cff-49cd-b189-4a4eed7f93af\",\"type\":\"WheelZoomTool\"},{\"id\":\"c53eaf4a-e62c-48b9-a53b-b98e3ac132e2\",\"type\":\"BoxZoomTool\"},{\"id\":\"79e608f2-9358-4121-9803-8785020b77a4\",\"type\":\"SaveTool\"},{\"id\":\"37b52290-609e-46c0-a15c-d3418095a941\",\"type\":\"ResetTool\"},{\"id\":\"083c5299-537d-4f53-8393-b9c5ad3ad81c\",\"type\":\"HelpTool\"}]},\"id\":\"f9ceda94-2e19-4b42-843a-bbda53228935\",\"type\":\"Toolbar\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"be2215fa-5cff-49cd-b189-4a4eed7f93af\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"083c5299-537d-4f53-8393-b9c5ad3ad81c\",\"type\":\"HelpTool\"},{\"attributes\":{\"fill_color\":{\"value\":\"#a44444\"},\"line_color\":{\"value\":\"#a44444\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"e6541246-cc2e-412c-a575-70842dce5b85\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null},\"id\":\"df21cd99-6a79-4183-96b9-29c43b66c0b5\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"79e608f2-9358-4121-9803-8785020b77a4\",\"type\":\"SaveTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"f9259bf8-f11d-4105-b80b-e25d59365246\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"label\":{\"value\":\"take 1\"},\"renderers\":[{\"id\":\"4c657569-cd5f-4ab3-9a57-ce57eb58f610\",\"type\":\"GlyphRenderer\"}]},\"id\":\"ef1e2ef1-44bb-48f8-ad69-52836f4886f6\",\"type\":\"LegendItem\"},{\"attributes\":{\"overlay\":{\"id\":\"f9259bf8-f11d-4105-b80b-e25d59365246\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"c53eaf4a-e62c-48b9-a53b-b98e3ac132e2\",\"type\":\"BoxZoomTool\"}],\"root_ids\":[\"f1c6f14f-3165-4df0-8e03-87264efeef52\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.5\"}};\n",
       "            var render_items = [{\"docid\":\"b8d953a1-f2f3-49ca-ba0e-f86f93f9730e\",\"elementid\":\"d15ea997-9b6b-46ef-b33b-54fe24978d4b\",\"modelid\":\"f1c6f14f-3165-4df0-8e03-87264efeef52\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i](window.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!window._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        window._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"d15ea997-9b6b-46ef-b33b-54fe24978d4b\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "play(HEAP, Player(HEAP), random_opponent)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 games, W/L ratio 0.0\n",
      "10000 games, W/L ratio 0.9976\n",
      "20000 games, W/L ratio 0.9995\n",
      "30000 games, W/L ratio 0.9996\n",
      "40000 games, W/L ratio 0.9998\n",
      "50000 games, W/L ratio 0.9998\n",
      "60000 games, W/L ratio 1.0\n",
      "70000 games, W/L ratio 1.0\n",
      "80000 games, W/L ratio 0.9999\n",
      "90000 games, W/L ratio 1.0\n",
      "100000 games, W/L ratio 1.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"c456d954-9ff7-4b1c-a810-4961ac2a2376\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    window._bokeh_timeout = Date.now() + 5000;\n",
       "    window._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (window.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"c456d954-9ff7-4b1c-a810-4961ac2a2376\");\n",
       "      el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "    } else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"c456d954-9ff7-4b1c-a810-4961ac2a2376\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'c456d954-9ff7-4b1c-a810-4961ac2a2376' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"c456d954-9ff7-4b1c-a810-4961ac2a2376\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!window._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      window._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"c456d954-9ff7-4b1c-a810-4961ac2a2376\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"58e04d88-a0e6-42ff-b222-872d9e1bba09\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      window._bokeh_timeout = Date.now() + 0;\n",
       "      window._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (window.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"58e04d88-a0e6-42ff-b222-872d9e1bba09\");\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      } else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"58e04d88-a0e6-42ff-b222-872d9e1bba09\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '58e04d88-a0e6-42ff-b222-872d9e1bba09' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"0c16a161-7e6f-4e88-90d6-60c9dfd79721\":{\"roots\":{\"references\":[{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a3d42b33-ed04-4418-b9f4-9ec6fbba9199\",\"type\":\"BasicTicker\"}},\"id\":\"7e858000-6fde-432c-9023-1189fe589471\",\"type\":\"Grid\"},{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"64c854db-cff9-4278-a71b-91de6fefed02\",\"type\":\"ResetTool\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"7b3e0c7e-2753-4cd3-bbad-9ce364d0412f\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"formatter\":{\"id\":\"3621acde-c85e-4355-b4b6-eade14a6ae6a\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a3d42b33-ed04-4418-b9f4-9ec6fbba9199\",\"type\":\"BasicTicker\"}},\"id\":\"54ad24e6-9001-44b2-9ca5-be4021cf4df7\",\"type\":\"LinearAxis\"},{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"84322a89-62f4-4682-bd08-ac59f884c9cf\",\"type\":\"PanTool\"},{\"attributes\":{\"callback\":null},\"id\":\"f5fe3759-a03e-4410-abf5-8c0984027e76\",\"type\":\"DataRange1d\"},{\"attributes\":{\"formatter\":{\"id\":\"9898e543-3286-4125-b504-35c3ba9d3145\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ef5f4d81-0724-4d68-91d9-8a1e2dd2e9e7\",\"type\":\"BasicTicker\"}},\"id\":\"f19e342f-72f9-470f-af5f-0ad126b0fe5e\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"3621acde-c85e-4355-b4b6-eade14a6ae6a\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"label\":{\"value\":\"take 3\"},\"renderers\":[{\"id\":\"4e0faca0-8c14-4005-bfca-48087f4ffa31\",\"type\":\"GlyphRenderer\"}]},\"id\":\"f3152297-3603-40c0-8a94-f3d934594aa5\",\"type\":\"LegendItem\"},{\"attributes\":{\"callback\":null},\"id\":\"f3fa4e39-a31e-4493-984b-01e573ccaf93\",\"type\":\"DataRange1d\"},{\"attributes\":{\"fill_color\":{\"value\":\"#a44444\"},\"line_color\":{\"value\":\"#a44444\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"2a5f9b0e-9fb0-466f-a25b-18d14f38309b\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"FR6qanP/7z+aw92ZqwP5PiOUlHwv3Ng/fnknXuSK4j8naUSpWK7jP3T/fC+F3Nw/EuPg1JKn2T8On8Av/hvrPgSettmHfhU/+Sz9KBbS5T/QyiY6vazFP7RS7qfEM1Q/Q1y2SIMt4z9V5ILqEN/7PvsDUmbV+OU/b5FUsqMp1j+SG7mRG7nRPz6BJTcWuiA/VVVVVVVV1T91TfyITb61P5Q+6ZM+6cM/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"Cg9Vtbn/7z+t+pe2C/7vP9bsxkqK3Ng/3zj9JLX/7z9erME24P/vP2iLS2wg/+8/y1z+do6P5T+kHjt5+lnmPwqsp7v9Yp0/luEbUWDS5T+e2wPY4f/vP5X7KfEMBeA/mA481dz/7z+uktL934/sP6bKgT6h+e8/CJXe1uj/7z8kN3IjN3LrP3hvXcOvKcc/OI7jOI7j6D9Vwpuh9r61PxzHcRzHcdw/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"e649ade1-d0eb-4cc6-ac6c-a21b213fbee4\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"overlay\":{\"id\":\"7b3e0c7e-2753-4cd3-bbad-9ce364d0412f\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"4d441780-6f38-4134-a3a6-5bb6d6fb0f95\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"ef5f4d81-0724-4d68-91d9-8a1e2dd2e9e7\",\"type\":\"BasicTicker\"}},\"id\":\"7a2bb33e-eded-482d-9a60-5cb5e787e17f\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"ef5f4d81-0724-4d68-91d9-8a1e2dd2e9e7\",\"type\":\"BasicTicker\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"ab976f7e-47c9-40b7-b11a-b92825dbde62\",\"type\":\"Title\"},{\"attributes\":{\"data_source\":{\"id\":\"25870038-d94a-4489-b76e-c38778fb6c65\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2a5f9b0e-9fb0-466f-a25b-18d14f38309b\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"aa86ab5b-4bdf-4c80-99ee-ce1d371534b6\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"d41ae514-2df4-4ff0-9bb9-c30aa42d7279\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"items\":[{\"id\":\"5e48f63f-d773-4303-8022-819fd288e190\",\"type\":\"LegendItem\"},{\"id\":\"a411ec5c-61cc-4fa9-b3c1-10c36427b828\",\"type\":\"LegendItem\"},{\"id\":\"f3152297-3603-40c0-8a94-f3d934594aa5\",\"type\":\"LegendItem\"}],\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"d5197f8a-c322-4abe-8f78-6bc198c6714d\",\"type\":\"Legend\"},{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"056b848e-ec24-4971-898a-3b47f18d62a6\",\"type\":\"HelpTool\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"cc2f0d50-f44d-44f0-81cf-e4d44bbdfe36\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"9898e543-3286-4125-b504-35c3ba9d3145\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#88a888\"},\"line_color\":{\"value\":\"#88a888\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"0d9a2db0-259b-4c31-aa49-93c85b3bd575\",\"type\":\"VBar\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"aa86ab5b-4bdf-4c80-99ee-ce1d371534b6\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"8c6932ee-adaf-4aa7-b857-7f7f62861e6e\",\"type\":\"ToolEvents\"},{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"71ea74d4-639b-449d-a650-fd08131140dc\",\"type\":\"SaveTool\"},{\"attributes\":{\"plot\":{\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"5a8c3b18-4637-4fda-95ec-4991924ed404\",\"type\":\"WheelZoomTool\"},{\"attributes\":{\"below\":[{\"id\":\"54ad24e6-9001-44b2-9ca5-be4021cf4df7\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"f19e342f-72f9-470f-af5f-0ad126b0fe5e\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"renderers\":[{\"id\":\"54ad24e6-9001-44b2-9ca5-be4021cf4df7\",\"type\":\"LinearAxis\"},{\"id\":\"7e858000-6fde-432c-9023-1189fe589471\",\"type\":\"Grid\"},{\"id\":\"f19e342f-72f9-470f-af5f-0ad126b0fe5e\",\"type\":\"LinearAxis\"},{\"id\":\"7a2bb33e-eded-482d-9a60-5cb5e787e17f\",\"type\":\"Grid\"},{\"id\":\"7b3e0c7e-2753-4cd3-bbad-9ce364d0412f\",\"type\":\"BoxAnnotation\"},{\"id\":\"d5197f8a-c322-4abe-8f78-6bc198c6714d\",\"type\":\"Legend\"},{\"id\":\"d41ae514-2df4-4ff0-9bb9-c30aa42d7279\",\"type\":\"GlyphRenderer\"},{\"id\":\"40a41a6b-85de-41e7-8cb7-09184bb1bbd6\",\"type\":\"GlyphRenderer\"},{\"id\":\"4e0faca0-8c14-4005-bfca-48087f4ffa31\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"ab976f7e-47c9-40b7-b11a-b92825dbde62\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"8c6932ee-adaf-4aa7-b857-7f7f62861e6e\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"029cb7d3-c4e1-46e4-adec-71b8a2ee2a8a\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"f3fa4e39-a31e-4493-984b-01e573ccaf93\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"f5fe3759-a03e-4410-abf5-8c0984027e76\",\"type\":\"DataRange1d\"}},\"id\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"data_source\":{\"id\":\"f27dce23-3508-44f9-b30b-b56fea45ba6f\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"2b9646c9-da89-46b7-866e-e48961459295\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"cc2f0d50-f44d-44f0-81cf-e4d44bbdfe36\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"4e0faca0-8c14-4005-bfca-48087f4ffa31\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"Cg9Vtbn/7z+t+pe2C/7vP9bsxkqK3Ng/3zj9JLX/7z9erME24P/vP2iLS2wg/+8/y1z+do6P5T+kHjt5+lnmPwqsp7v9Yp0/luEbUWDS5T+e2wPY4f/vP5X7KfEMBeA/mA481dz/7z+uktL934/sP6bKgT6h+e8/CJXe1uj/7z8kN3IjN3LrP3hvXcOvKcc/OI7jOI7j6D9Vwpuh9r61PxzHcRzHcdw/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"////////7z8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/////////7z8AAAAAAADwPwAAAAAAAPA/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"f27dce23-3508-44f9-b30b-b56fea45ba6f\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"a3d42b33-ed04-4418-b9f4-9ec6fbba9199\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"65191ea1-b42e-4af7-b167-0f647edcb132\",\"type\":\"VBar\"},{\"attributes\":{\"label\":{\"value\":\"take 1\"},\"renderers\":[{\"id\":\"d41ae514-2df4-4ff0-9bb9-c30aa42d7279\",\"type\":\"GlyphRenderer\"}]},\"id\":\"5e48f63f-d773-4303-8022-819fd288e190\",\"type\":\"LegendItem\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#ccccac\"},\"line_color\":{\"value\":\"#ccccac\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"2b9646c9-da89-46b7-866e-e48961459295\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\"],\"data\":{\"top\":{\"__ndarray__\":\"FR6qanP/7z+aw92ZqwP5PiOUlHwv3Ng/fnknXuSK4j8naUSpWK7jP3T/fC+F3Nw/EuPg1JKn2T8On8Av/hvrPgSettmHfhU/+Sz9KBbS5T/QyiY6vazFP7RS7qfEM1Q/Q1y2SIMt4z9V5ILqEN/7PvsDUmbV+OU/b5FUsqMp1j+SG7mRG7nRPz6BJTcWuiA/VVVVVVVV1T91TfyITb61P5Q+6ZM+6cM/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"25870038-d94a-4489-b76e-c38778fb6c65\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"84322a89-62f4-4682-bd08-ac59f884c9cf\",\"type\":\"PanTool\"},{\"id\":\"5a8c3b18-4637-4fda-95ec-4991924ed404\",\"type\":\"WheelZoomTool\"},{\"id\":\"4d441780-6f38-4134-a3a6-5bb6d6fb0f95\",\"type\":\"BoxZoomTool\"},{\"id\":\"71ea74d4-639b-449d-a650-fd08131140dc\",\"type\":\"SaveTool\"},{\"id\":\"64c854db-cff9-4278-a71b-91de6fefed02\",\"type\":\"ResetTool\"},{\"id\":\"056b848e-ec24-4971-898a-3b47f18d62a6\",\"type\":\"HelpTool\"}]},\"id\":\"029cb7d3-c4e1-46e4-adec-71b8a2ee2a8a\",\"type\":\"Toolbar\"},{\"attributes\":{\"label\":{\"value\":\"take 2\"},\"renderers\":[{\"id\":\"40a41a6b-85de-41e7-8cb7-09184bb1bbd6\",\"type\":\"GlyphRenderer\"}]},\"id\":\"a411ec5c-61cc-4fa9-b3c1-10c36427b828\",\"type\":\"LegendItem\"},{\"attributes\":{\"data_source\":{\"id\":\"e649ade1-d0eb-4cc6-ac6c-a21b213fbee4\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"0d9a2db0-259b-4c31-aa49-93c85b3bd575\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"65191ea1-b42e-4af7-b167-0f647edcb132\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"40a41a6b-85de-41e7-8cb7-09184bb1bbd6\",\"type\":\"GlyphRenderer\"}],\"root_ids\":[\"6bd173ab-7a62-4caa-876a-bf59ae682a36\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.5\"}};\n",
       "            var render_items = [{\"docid\":\"0c16a161-7e6f-4e88-90d6-60c9dfd79721\",\"elementid\":\"58e04d88-a0e6-42ff-b222-872d9e1bba09\",\"modelid\":\"6bd173ab-7a62-4caa-876a-bf59ae682a36\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i](window.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!window._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        window._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"58e04d88-a0e6-42ff-b222-872d9e1bba09\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "play(HEAP, Player(HEAP), take_n_opponent(1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 games, W/L ratio 0.0\n",
      "10000 games, W/L ratio 0.9706\n",
      "20000 games, W/L ratio 0.9971\n",
      "30000 games, W/L ratio 0.9969\n",
      "40000 games, W/L ratio 0.9989\n",
      "50000 games, W/L ratio 0.9997\n",
      "60000 games, W/L ratio 0.9998\n",
      "70000 games, W/L ratio 1.0\n",
      "80000 games, W/L ratio 1.0\n",
      "90000 games, W/L ratio 0.9999\n",
      "100000 games, W/L ratio 1.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <a href=\"http://bokeh.pydata.org\" target=\"_blank\" class=\"bk-logo bk-logo-small bk-logo-notebook\"></a>\n",
       "        <span id=\"cc313b98-f7c0-4a7f-bd9f-01fbfa937930\">Loading BokehJS ...</span>\n",
       "    </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "(function(global) {\n",
       "  function now() {\n",
       "    return new Date();\n",
       "  }\n",
       "\n",
       "  var force = true;\n",
       "\n",
       "  if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "    window._bokeh_onload_callbacks = [];\n",
       "    window._bokeh_is_loading = undefined;\n",
       "  }\n",
       "\n",
       "\n",
       "  \n",
       "  if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "    window._bokeh_timeout = Date.now() + 5000;\n",
       "    window._bokeh_failed_load = false;\n",
       "  }\n",
       "\n",
       "  var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "     \"<div style='background-color: #fdd'>\\n\"+\n",
       "     \"<p>\\n\"+\n",
       "     \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "     \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "     \"</p>\\n\"+\n",
       "     \"<ul>\\n\"+\n",
       "     \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "     \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "     \"</ul>\\n\"+\n",
       "     \"<code>\\n\"+\n",
       "     \"from bokeh.resources import INLINE\\n\"+\n",
       "     \"output_notebook(resources=INLINE)\\n\"+\n",
       "     \"</code>\\n\"+\n",
       "     \"</div>\"}};\n",
       "\n",
       "  function display_loaded() {\n",
       "    if (window.Bokeh !== undefined) {\n",
       "      var el = document.getElementById(\"cc313b98-f7c0-4a7f-bd9f-01fbfa937930\");\n",
       "      el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "    } else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(display_loaded, 100)\n",
       "    }\n",
       "  }\n",
       "\n",
       "  function run_callbacks() {\n",
       "    window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "    delete window._bokeh_onload_callbacks\n",
       "    console.info(\"Bokeh: all callbacks have finished\");\n",
       "  }\n",
       "\n",
       "  function load_libs(js_urls, callback) {\n",
       "    window._bokeh_onload_callbacks.push(callback);\n",
       "    if (window._bokeh_is_loading > 0) {\n",
       "      console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "      return null;\n",
       "    }\n",
       "    if (js_urls == null || js_urls.length === 0) {\n",
       "      run_callbacks();\n",
       "      return null;\n",
       "    }\n",
       "    console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "    window._bokeh_is_loading = js_urls.length;\n",
       "    for (var i = 0; i < js_urls.length; i++) {\n",
       "      var url = js_urls[i];\n",
       "      var s = document.createElement('script');\n",
       "      s.src = url;\n",
       "      s.async = false;\n",
       "      s.onreadystatechange = s.onload = function() {\n",
       "        window._bokeh_is_loading--;\n",
       "        if (window._bokeh_is_loading === 0) {\n",
       "          console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "          run_callbacks()\n",
       "        }\n",
       "      };\n",
       "      s.onerror = function() {\n",
       "        console.warn(\"failed to load library \" + url);\n",
       "      };\n",
       "      console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "      document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "    }\n",
       "  };var element = document.getElementById(\"cc313b98-f7c0-4a7f-bd9f-01fbfa937930\");\n",
       "  if (element == null) {\n",
       "    console.log(\"Bokeh: ERROR: autoload.js configured with elementid 'cc313b98-f7c0-4a7f-bd9f-01fbfa937930' but no matching script tag was found. \")\n",
       "    return false;\n",
       "  }\n",
       "\n",
       "  var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.js\"];\n",
       "\n",
       "  var inline_js = [\n",
       "    function(Bokeh) {\n",
       "      Bokeh.set_log_level(\"info\");\n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "    },\n",
       "    \n",
       "    function(Bokeh) {\n",
       "      \n",
       "      document.getElementById(\"cc313b98-f7c0-4a7f-bd9f-01fbfa937930\").textContent = \"BokehJS is loading...\";\n",
       "    },\n",
       "    function(Bokeh) {\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.5.min.css\");\n",
       "      console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "      Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.5.min.css\");\n",
       "    }\n",
       "  ];\n",
       "\n",
       "  function run_inline_js() {\n",
       "    \n",
       "    if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "      for (var i = 0; i < inline_js.length; i++) {\n",
       "        inline_js[i](window.Bokeh);\n",
       "      }if (force === true) {\n",
       "        display_loaded();\n",
       "      }} else if (Date.now() < window._bokeh_timeout) {\n",
       "      setTimeout(run_inline_js, 100);\n",
       "    } else if (!window._bokeh_failed_load) {\n",
       "      console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "      window._bokeh_failed_load = true;\n",
       "    } else if (force !== true) {\n",
       "      var cell = $(document.getElementById(\"cc313b98-f7c0-4a7f-bd9f-01fbfa937930\")).parents('.cell').data().cell;\n",
       "      cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "    }\n",
       "\n",
       "  }\n",
       "\n",
       "  if (window._bokeh_is_loading === 0) {\n",
       "    console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "    run_inline_js();\n",
       "  } else {\n",
       "    load_libs(js_urls, function() {\n",
       "      console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "      run_inline_js();\n",
       "    });\n",
       "  }\n",
       "}(this));"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "    <div class=\"bk-root\">\n",
       "        <div class=\"bk-plotdiv\" id=\"01a705f0-81f5-4558-b9cd-5461ec1fcdec\"></div>\n",
       "    </div>\n",
       "<script type=\"text/javascript\">\n",
       "  \n",
       "  (function(global) {\n",
       "    function now() {\n",
       "      return new Date();\n",
       "    }\n",
       "  \n",
       "    var force = false;\n",
       "  \n",
       "    if (typeof (window._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n",
       "      window._bokeh_onload_callbacks = [];\n",
       "      window._bokeh_is_loading = undefined;\n",
       "    }\n",
       "  \n",
       "  \n",
       "    \n",
       "    if (typeof (window._bokeh_timeout) === \"undefined\" || force === true) {\n",
       "      window._bokeh_timeout = Date.now() + 0;\n",
       "      window._bokeh_failed_load = false;\n",
       "    }\n",
       "  \n",
       "    var NB_LOAD_WARNING = {'data': {'text/html':\n",
       "       \"<div style='background-color: #fdd'>\\n\"+\n",
       "       \"<p>\\n\"+\n",
       "       \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n",
       "       \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n",
       "       \"</p>\\n\"+\n",
       "       \"<ul>\\n\"+\n",
       "       \"<li>re-rerun `output_notebook()` to attempt to load from CDN again, or</li>\\n\"+\n",
       "       \"<li>use INLINE resources instead, as so:</li>\\n\"+\n",
       "       \"</ul>\\n\"+\n",
       "       \"<code>\\n\"+\n",
       "       \"from bokeh.resources import INLINE\\n\"+\n",
       "       \"output_notebook(resources=INLINE)\\n\"+\n",
       "       \"</code>\\n\"+\n",
       "       \"</div>\"}};\n",
       "  \n",
       "    function display_loaded() {\n",
       "      if (window.Bokeh !== undefined) {\n",
       "        var el = document.getElementById(\"01a705f0-81f5-4558-b9cd-5461ec1fcdec\");\n",
       "        el.textContent = \"BokehJS \" + Bokeh.version + \" successfully loaded.\";\n",
       "      } else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(display_loaded, 100)\n",
       "      }\n",
       "    }\n",
       "  \n",
       "    function run_callbacks() {\n",
       "      window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n",
       "      delete window._bokeh_onload_callbacks\n",
       "      console.info(\"Bokeh: all callbacks have finished\");\n",
       "    }\n",
       "  \n",
       "    function load_libs(js_urls, callback) {\n",
       "      window._bokeh_onload_callbacks.push(callback);\n",
       "      if (window._bokeh_is_loading > 0) {\n",
       "        console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n",
       "        return null;\n",
       "      }\n",
       "      if (js_urls == null || js_urls.length === 0) {\n",
       "        run_callbacks();\n",
       "        return null;\n",
       "      }\n",
       "      console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n",
       "      window._bokeh_is_loading = js_urls.length;\n",
       "      for (var i = 0; i < js_urls.length; i++) {\n",
       "        var url = js_urls[i];\n",
       "        var s = document.createElement('script');\n",
       "        s.src = url;\n",
       "        s.async = false;\n",
       "        s.onreadystatechange = s.onload = function() {\n",
       "          window._bokeh_is_loading--;\n",
       "          if (window._bokeh_is_loading === 0) {\n",
       "            console.log(\"Bokeh: all BokehJS libraries loaded\");\n",
       "            run_callbacks()\n",
       "          }\n",
       "        };\n",
       "        s.onerror = function() {\n",
       "          console.warn(\"failed to load library \" + url);\n",
       "        };\n",
       "        console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n",
       "        document.getElementsByTagName(\"head\")[0].appendChild(s);\n",
       "      }\n",
       "    };var element = document.getElementById(\"01a705f0-81f5-4558-b9cd-5461ec1fcdec\");\n",
       "    if (element == null) {\n",
       "      console.log(\"Bokeh: ERROR: autoload.js configured with elementid '01a705f0-81f5-4558-b9cd-5461ec1fcdec' but no matching script tag was found. \")\n",
       "      return false;\n",
       "    }\n",
       "  \n",
       "    var js_urls = [];\n",
       "  \n",
       "    var inline_js = [\n",
       "      function(Bokeh) {\n",
       "        (function() {\n",
       "          var fn = function() {\n",
       "            var docs_json = {\"d03fad84-dc1f-4f92-823e-d3a53dc4db59\":{\"roots\":{\"references\":[{\"attributes\":{\"formatter\":{\"id\":\"5c35675e-0e11-4f5a-877c-2af13a1d3c0d\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a464fcea-499c-497c-b811-bec87ca13b58\",\"type\":\"BasicTicker\"}},\"id\":\"2e0db1f6-96ee-41e5-9276-6cf1ddd5ce49\",\"type\":\"LinearAxis\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#88a888\"},\"line_color\":{\"value\":\"#88a888\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"4979ffe2-aeff-4fd6-a29f-1e0cb2579d8c\",\"type\":\"VBar\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"58cd9974-ee56-4ac4-9349-29aa4c5781c3\",\"type\":\"SaveTool\"},{\"attributes\":{\"overlay\":{\"id\":\"e1ac4bbf-e1ba-4bd2-8b3d-7c5529e1180d\",\"type\":\"BoxAnnotation\"},\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"841a898d-5723-4a1e-b542-ec0d867b6d54\",\"type\":\"BoxZoomTool\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"4d500025-a4fb-4d5c-93a7-dc1d15291929\",\"type\":\"PanTool\"},{\"attributes\":{\"plot\":null,\"text\":\"\"},\"id\":\"34032950-971d-4ab6-88ec-c8c841ccda51\",\"type\":\"Title\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"df6fa84f-5b7b-4b11-8aa0-9b65f8b6a896\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"a464fcea-499c-497c-b811-bec87ca13b58\",\"type\":\"BasicTicker\"},{\"attributes\":{\"bottom_units\":\"screen\",\"fill_alpha\":{\"value\":0.5},\"fill_color\":{\"value\":\"lightgrey\"},\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":{\"value\":1.0},\"line_color\":{\"value\":\"black\"},\"line_dash\":[4,4],\"line_width\":{\"value\":2},\"plot\":null,\"render_mode\":\"css\",\"right_units\":\"screen\",\"top_units\":\"screen\"},\"id\":\"e1ac4bbf-e1ba-4bd2-8b3d-7c5529e1180d\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"fill_color\":{\"value\":\"#a44444\"},\"line_color\":{\"value\":\"#a44444\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"23ed9547-f1a5-4c25-9801-bc7629ff6721\",\"type\":\"VBar\"},{\"attributes\":{},\"id\":\"52a2f42d-af49-423d-a6b1-d11b68620a2c\",\"type\":\"BasicTicker\"},{\"attributes\":{\"formatter\":{\"id\":\"9387c141-ad59-4ac7-8063-c09bbd2ff8f5\",\"type\":\"BasicTickFormatter\"},\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"52a2f42d-af49-423d-a6b1-d11b68620a2c\",\"type\":\"BasicTicker\"}},\"id\":\"4d0aa21e-813d-4bf6-8aae-70e25f48c8ad\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"5c35675e-0e11-4f5a-877c-2af13a1d3c0d\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"c7bf14f0-76e5-4d1f-8622-3aad4aed29b8\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null},\"id\":\"1012cc58-aac6-4b1e-81bb-fc37bfbf5852\",\"type\":\"DataRange1d\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"4a821d09-f309-4250-8425-eed87f881c1d\",\"type\":\"HelpTool\"},{\"attributes\":{\"below\":[{\"id\":\"2e0db1f6-96ee-41e5-9276-6cf1ddd5ce49\",\"type\":\"LinearAxis\"}],\"left\":[{\"id\":\"4d0aa21e-813d-4bf6-8aae-70e25f48c8ad\",\"type\":\"LinearAxis\"}],\"plot_height\":400,\"renderers\":[{\"id\":\"2e0db1f6-96ee-41e5-9276-6cf1ddd5ce49\",\"type\":\"LinearAxis\"},{\"id\":\"37160199-3717-4762-a6c1-693cf327b892\",\"type\":\"Grid\"},{\"id\":\"4d0aa21e-813d-4bf6-8aae-70e25f48c8ad\",\"type\":\"LinearAxis\"},{\"id\":\"61c37ff9-dc37-402a-8da1-5d2eaba8c6a6\",\"type\":\"Grid\"},{\"id\":\"e1ac4bbf-e1ba-4bd2-8b3d-7c5529e1180d\",\"type\":\"BoxAnnotation\"},{\"id\":\"97ba062f-ffbc-4608-a529-45b9ea31a0d4\",\"type\":\"Legend\"},{\"id\":\"06de6e8c-108c-4876-b58a-9f7cc53b0706\",\"type\":\"GlyphRenderer\"},{\"id\":\"f66871bf-2af0-41f8-9bb6-71d60a36c253\",\"type\":\"GlyphRenderer\"},{\"id\":\"0661ce1e-ded2-41f8-8910-fcc7adb6491c\",\"type\":\"GlyphRenderer\"}],\"title\":{\"id\":\"34032950-971d-4ab6-88ec-c8c841ccda51\",\"type\":\"Title\"},\"tool_events\":{\"id\":\"5b15eb90-24c6-4da6-845b-382bf6fb4a67\",\"type\":\"ToolEvents\"},\"toolbar\":{\"id\":\"272c921a-44dc-4202-a5a3-29c20b16f3a0\",\"type\":\"Toolbar\"},\"x_range\":{\"id\":\"614ec534-6edc-408e-9a91-bb43efd15c0e\",\"type\":\"DataRange1d\"},\"y_range\":{\"id\":\"1012cc58-aac6-4b1e-81bb-fc37bfbf5852\",\"type\":\"DataRange1d\"}},\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"4903f453-4d9d-41be-9dd3-e5d4f8375e56\",\"type\":\"ResetTool\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"8AepTcf/7z8s7vHm8qEFP/6Cu+YlR0U/L5BJ8QKZ1D/OiDcj3ozoP0fZCujUSdI/f7WSr7vH7T6UM29Z30geP7ON9lULzNg/0iAN0iAN4j9AOpYyCXbVPwyqoTK9U+0+JyLIdcFiAz85juM4juPUP7kg44KMC+I/CMmAeqZy3T9zF/xVnJDSP45DPpY/QOU+VVVVVVVV1T9VVVVVVVXVP35we1Fy9NY/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"+IPUpuP/7z8Ue92SRPvvP/6Cu+YlR2U/nhP8M48W5T+ywcUGFxvsP0IBTyOZ/+8/FX8qfjYqxD+KjINy5i3DP8byEUO34uA/7MRO7MRO7D/MDTEgHUvpPzMyUhBtA+c/Ws74l9V/0z8cx3Ecx3HiP1yQcUHGBek/h07aB8mA6j8yog+ojr3lP5uADUeqeNE/VVVVVVVV5T9VVVVVVVXlP5Tvvs48bOY/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"7acb26aa-13fa-4af1-be9b-a518a67de4a5\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"label\":{\"value\":\"take 3\"},\"renderers\":[{\"id\":\"0661ce1e-ded2-41f8-8910-fcc7adb6491c\",\"type\":\"GlyphRenderer\"}]},\"id\":\"168bc212-9d0d-4fc9-8f56-fccb34a994f2\",\"type\":\"LegendItem\"},{\"attributes\":{},\"id\":\"9387c141-ad59-4ac7-8063-c09bbd2ff8f5\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"cbfcace1-a00b-4b84-b8d8-e3678a103d98\",\"type\":\"VBar\"},{\"attributes\":{\"label\":{\"value\":\"take 2\"},\"renderers\":[{\"id\":\"f66871bf-2af0-41f8-9bb6-71d60a36c253\",\"type\":\"GlyphRenderer\"}]},\"id\":\"e3e86a57-d084-4304-b162-1b6ee397580c\",\"type\":\"LegendItem\"},{\"attributes\":{\"label\":{\"value\":\"take 1\"},\"renderers\":[{\"id\":\"06de6e8c-108c-4876-b58a-9f7cc53b0706\",\"type\":\"GlyphRenderer\"}]},\"id\":\"d89b8ce6-4935-45fc-9c54-14fe3d54f681\",\"type\":\"LegendItem\"},{\"attributes\":{\"items\":[{\"id\":\"d89b8ce6-4935-45fc-9c54-14fe3d54f681\",\"type\":\"LegendItem\"},{\"id\":\"e3e86a57-d084-4304-b162-1b6ee397580c\",\"type\":\"LegendItem\"},{\"id\":\"168bc212-9d0d-4fc9-8f56-fccb34a994f2\",\"type\":\"LegendItem\"}],\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"}},\"id\":\"97ba062f-ffbc-4608-a529-45b9ea31a0d4\",\"type\":\"Legend\"},{\"attributes\":{\"data_source\":{\"id\":\"8b71457f-9ce3-4cdd-8249-7d68da0cfca0\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"aa8971e8-185d-4239-b394-a9d299097595\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"cbfcace1-a00b-4b84-b8d8-e3678a103d98\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"0661ce1e-ded2-41f8-8910-fcc7adb6491c\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"data_source\":{\"id\":\"7acb26aa-13fa-4af1-be9b-a518a67de4a5\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"4979ffe2-aeff-4fd6-a29f-1e0cb2579d8c\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"a38b5467-beb8-4b88-a5c2-bd976041229b\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"f66871bf-2af0-41f8-9bb6-71d60a36c253\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\"],\"data\":{\"top\":{\"__ndarray__\":\"8AepTcf/7z8s7vHm8qEFP/6Cu+YlR0U/L5BJ8QKZ1D/OiDcj3ozoP0fZCujUSdI/f7WSr7vH7T6UM29Z30geP7ON9lULzNg/0iAN0iAN4j9AOpYyCXbVPwyqoTK9U+0+JyLIdcFiAz85juM4juPUP7kg44KMC+I/CMmAeqZy3T9zF/xVnJDSP45DPpY/QOU+VVVVVVVV1T9VVVVVVVXVP35we1Fy9NY/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"5b2f9df2-8fc0-4f56-abbc-649604d160e8\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"5b15eb90-24c6-4da6-845b-382bf6fb4a67\",\"type\":\"ToolEvents\"},{\"attributes\":{\"data_source\":{\"id\":\"5b2f9df2-8fc0-4f56-abbc-649604d160e8\",\"type\":\"ColumnDataSource\"},\"glyph\":{\"id\":\"23ed9547-f1a5-4c25-9801-bc7629ff6721\",\"type\":\"VBar\"},\"hover_glyph\":null,\"muted_glyph\":null,\"nonselection_glyph\":{\"id\":\"c7bf14f0-76e5-4d1f-8622-3aad4aed29b8\",\"type\":\"VBar\"},\"selection_glyph\":null},\"id\":\"06de6e8c-108c-4876-b58a-9f7cc53b0706\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"a464fcea-499c-497c-b811-bec87ca13b58\",\"type\":\"BasicTicker\"}},\"id\":\"37160199-3717-4762-a6c1-693cf327b892\",\"type\":\"Grid\"},{\"attributes\":{\"callback\":null},\"id\":\"614ec534-6edc-408e-9a91-bb43efd15c0e\",\"type\":\"DataRange1d\"},{\"attributes\":{\"dimension\":1,\"plot\":{\"id\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\",\"subtype\":\"Figure\",\"type\":\"Plot\"},\"ticker\":{\"id\":\"52a2f42d-af49-423d-a6b1-d11b68620a2c\",\"type\":\"BasicTicker\"}},\"id\":\"61c37ff9-dc37-402a-8da1-5d2eaba8c6a6\",\"type\":\"Grid\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"a38b5467-beb8-4b88-a5c2-bd976041229b\",\"type\":\"VBar\"},{\"attributes\":{\"callback\":null,\"column_names\":[\"x\",\"top\",\"bottom\"],\"data\":{\"bottom\":{\"__ndarray__\":\"+IPUpuP/7z8Ue92SRPvvP/6Cu+YlR2U/nhP8M48W5T+ywcUGFxvsP0IBTyOZ/+8/FX8qfjYqxD+KjINy5i3DP8byEUO34uA/7MRO7MRO7D/MDTEgHUvpPzMyUhBtA+c/Ws74l9V/0z8cx3Ecx3HiP1yQcUHGBek/h07aB8mA6j8yog+ojr3lP5uADUeqeNE/VVVVVVVV5T9VVVVVVVXlP5Tvvs48bOY/\",\"dtype\":\"float64\",\"shape\":[21]},\"top\":{\"__ndarray__\":\"AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwPwAAAAAAAPA/AAAAAAAA8D/////////vPwAAAAAAAPA/AAAAAAAA8D8AAAAAAADwP////////+8/\",\"dtype\":\"float64\",\"shape\":[21]},\"x\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]}},\"id\":\"8b71457f-9ce3-4cdd-8249-7d68da0cfca0\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"active_drag\":\"auto\",\"active_scroll\":\"auto\",\"active_tap\":\"auto\",\"tools\":[{\"id\":\"4d500025-a4fb-4d5c-93a7-dc1d15291929\",\"type\":\"PanTool\"},{\"id\":\"df6fa84f-5b7b-4b11-8aa0-9b65f8b6a896\",\"type\":\"WheelZoomTool\"},{\"id\":\"841a898d-5723-4a1e-b542-ec0d867b6d54\",\"type\":\"BoxZoomTool\"},{\"id\":\"58cd9974-ee56-4ac4-9349-29aa4c5781c3\",\"type\":\"SaveTool\"},{\"id\":\"4903f453-4d9d-41be-9dd3-e5d4f8375e56\",\"type\":\"ResetTool\"},{\"id\":\"4a821d09-f309-4250-8425-eed87f881c1d\",\"type\":\"HelpTool\"}]},\"id\":\"272c921a-44dc-4202-a5a3-29c20b16f3a0\",\"type\":\"Toolbar\"},{\"attributes\":{\"bottom\":{\"field\":\"bottom\"},\"fill_color\":{\"value\":\"#ccccac\"},\"line_color\":{\"value\":\"#ccccac\"},\"top\":{\"field\":\"top\"},\"width\":{\"value\":0.8},\"x\":{\"field\":\"x\"}},\"id\":\"aa8971e8-185d-4239-b394-a9d299097595\",\"type\":\"VBar\"}],\"root_ids\":[\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\"]},\"title\":\"Bokeh Application\",\"version\":\"0.12.5\"}};\n",
       "            var render_items = [{\"docid\":\"d03fad84-dc1f-4f92-823e-d3a53dc4db59\",\"elementid\":\"01a705f0-81f5-4558-b9cd-5461ec1fcdec\",\"modelid\":\"83405bd4-eab1-44f1-b4a6-5ed42597b4b6\"}];\n",
       "            \n",
       "            Bokeh.embed.embed_items(docs_json, render_items);\n",
       "          };\n",
       "          if (document.readyState != \"loading\") fn();\n",
       "          else document.addEventListener(\"DOMContentLoaded\", fn);\n",
       "        })();\n",
       "      },\n",
       "      function(Bokeh) {\n",
       "      }\n",
       "    ];\n",
       "  \n",
       "    function run_inline_js() {\n",
       "      \n",
       "      if ((window.Bokeh !== undefined) || (force === true)) {\n",
       "        for (var i = 0; i < inline_js.length; i++) {\n",
       "          inline_js[i](window.Bokeh);\n",
       "        }if (force === true) {\n",
       "          display_loaded();\n",
       "        }} else if (Date.now() < window._bokeh_timeout) {\n",
       "        setTimeout(run_inline_js, 100);\n",
       "      } else if (!window._bokeh_failed_load) {\n",
       "        console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n",
       "        window._bokeh_failed_load = true;\n",
       "      } else if (force !== true) {\n",
       "        var cell = $(document.getElementById(\"01a705f0-81f5-4558-b9cd-5461ec1fcdec\")).parents('.cell').data().cell;\n",
       "        cell.output_area.append_execute_result(NB_LOAD_WARNING)\n",
       "      }\n",
       "  \n",
       "    }\n",
       "  \n",
       "    if (window._bokeh_is_loading === 0) {\n",
       "      console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n",
       "      run_inline_js();\n",
       "    } else {\n",
       "      load_libs(js_urls, function() {\n",
       "        console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n",
       "        run_inline_js();\n",
       "      });\n",
       "    }\n",
       "  }(this));\n",
       "</script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "play(HEAP, Player(HEAP), take_n_opponent(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
